//BZOJ 2038
#include <bits/stdc++.h>

using std::sort;
using std::swap;

const int maxn=50005;

struct iostream
{
    const static int bufsiz=1500000;
    char inbuf[bufsiz],oubuf[bufsiz];
    int inp,oup;
    iostream():inp(bufsiz),oup(0){}
    inline iostream& operator >> (char &c){
        static int end=bufsiz;
        if(inp==end) end=fread(inbuf,1,bufsiz,stdin),inp=0;
        if(inp==end) c=EOF;
        else c=inbuf[inp++];
        return *this;
    }
    template <typename T> inline iostream& operator >> (T &r){
        char c;bool f=0;
        for(*this>>c;c>'9'||c<'0';*this>>c) if(c=='-') f=1;
        for(r=0;c<='9'&&c>='0';*this>>c) r=r*10+c-'0';
        if(f) r=-r;
        return *this;
    }
    inline iostream& operator << (const char &c){
        oubuf[oup++]=c;
        if(oup==bufsiz) fwrite(oubuf,bufsiz,1,stdout);
        return *this;
    }
    template <typename T> inline iostream& operator << (T r){
        static int sta[50];int len=0;
        if(r<0){*this<<'-';r=-r;}
        while(r) sta[len++]=r%10,r/=10;
        if(!len) *this<<'0';
        while(len--) *this<<(char)(sta[len]+'0');
        return *this;
    }
    ~iostream(){
        fwrite(oubuf,oup,1,stdout);
    }
};
struct Query
{
    int l,r,id;
    const bool operator < (const Query &q) const;
};

int c[maxn],bn[maxn]; //block_number
long long num[maxn],den[maxn]; //numerator denominator
int cnt[maxn];
Query q[maxn];
iostream io;

long long sigma;int l,r;
const bool Query::operator < (const Query &q) const{
    return bn[l]==bn[q.l]?r<q.r:l<q.l;
}
inline void adjust(const int &nl,const int &nr){
    while(l<nl) sigma+=1-2ll*cnt[c[l]],cnt[c[l++]]--;
    while(l>nl) sigma+=1+2ll*cnt[c[--l]],cnt[c[l]]++;
    while(r<nr) sigma+=1+2ll*cnt[c[++r]],cnt[c[r]]++;
    while(r>nr) sigma+=1-2ll*cnt[c[r]],cnt[c[r--]]--;
}

template <typename T> T gcd(const T &x,const T &y){
    return y?gcd(y,x%y):x;
}

int main(){
    int n,m,block_size;

    freopen("hose.in","r",stdin);
    freopen("hose.out","w",stdout);

    io>>n>>m;
    for(int i=1;i<=n;i++) io>>c[i];
    for(int i=0;i<m;i++) io>>q[i].l>>q[i].r,q[i].id=i;
    block_size=ceil(sqrt(n));
    for(int i=1;i<=n;i++) bn[i]=(i-1)/block_size;

    sort(q,q+m);
    sigma=1;l=r=1;cnt[c[1]]=1;
    for(int i=0;i<m;i++){
        adjust(q[i].l,q[i].r);
        num[q[i].id]=sigma-(q[i].r-q[i].l+1);
        den[q[i].id]=(q[i].r-q[i].l+1ll)*(q[i].r-q[i].l);
        if(!den[q[i].id]) den[q[i].id]=1;
        long long g=gcd(num[q[i].id],den[q[i].id]);
        num[q[i].id]/=g;den[q[i].id]/=g;
    }

    for(int i=0;i<m;i++) io<<num[i]<<'/'<<den[i]<<'\n';
    return 0;
}
